<HTML>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<BODY>
<form action="http://www.baidu.com" onsubmit="return toVaild">
    <input type="text" id="ff">
    <input type="submit" id="submit" value ="提交"/>
</form>
</BODY>
<script language="javascript">
    var toVaild;
    (function(){
        toVaild=  function (){
            var val = document.getElementById("ff").value;
            alert(val+"min");
            if(val == "1"){
                alert("校验成功，之后进行提交");
                return true;
            }
            else{
                alert("校验失败，不进行提交");
                return false;
            }
        };
    })
</script>
</HTML>